using System;
using System.Collections.Specialized;
using System.Xml;
using System.Xml.XPath;


namespace WCSFContrib.PageFlow.Xml.Configuration
{
    /// <summary>
    /// The StatePersistenceProviderSettings class is a representation of the 
    /// state persistence configuration defined in the configuration file.
    /// </summary>
    public class StatePersistenceProviderSettings : ObjectTypeSettings
    {
        #region Declares Variables
        private NameValueCollection _attributes;
        #endregion

        #region Constructor

        /// <summary>
        /// Creates an instance of the StatePersistenceProviderSettings class using the specified configNode.
        /// </summary>
        public StatePersistenceProviderSettings(IXPathNavigable configNode)
            : base(configNode)
        {
            LoadAttributes((XmlNode)configNode);
        }

        private void LoadAttributes(XmlNode configNode)
        {
            _attributes = new NameValueCollection();
            foreach (XmlAttribute currentAttribute in configNode.Attributes)
            {
                _attributes.Add(currentAttribute.Name, currentAttribute.Value);
            }
        }
        #endregion

        #region Properties

        /// <summary>
        /// Gets the state persistence attributes.
        /// </summary>
        public NameValueCollection AdditionalAttributes
        {
            get { return _attributes; }
        }
        #endregion
    }
}
